import java.util.ArrayList;
import java.util.Collection;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-03-02
 * Time: 17:32
 */

public class CollectionFor {
    @SuppressWarnings({"all"})
    public static void main(String[] args) {
        Collection col = new ArrayList();
        col.add(new Book("三国演绎","罗贯中",10.1));
        col.add(new Book("小李飞到","古龙",5.1));
        col.add(new Book("红楼梦","曹雪芹",34.6));

        //增强for循环 接收类型 接收变量 : 遍历的集合
        //1.底层 也是迭代器 断点可以观察
        // 快捷键 I 自动生成增强for
        for (Object book : col){
            System.out.println("book" + book);
        }

        //也可以直接在数组中使用
        int[] nums = {1,3,4,7,8,9};
        for (int i : nums){
            System.out.println("i=" + i);
        }

    }
}
